////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                            //
//                                                         WNProject                                                          //
//                                                                                                                            //
//            This file is distributed under the BSD 2-Clause open source license. See License.txt for details.               //
//                                                                                                                            //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef __WN_EXTENDED_MATH_H__
#define __WN_EXTENDED_MATH_H__

#include "WNCore/inc/WNBase.h"

namespace WNMath {
    class WNPoint2;
    class WNPoint3;
    class WNVector2;
    class WNVector3;
    class WNQuaternion;
    class WNPlane;
    class WNRay2;
    class WNRay3;
    class WNLine2;
    class WNLine3;
    class WNSegment2;
    class WNSegment3;

    WN_FLOAT32 WNDistance(const WNPoint2& _point1, const WNPoint2& _point2);
    WN_FLOAT32 WNDistance(const WNPoint3& _point1, const WNPoint3& _point2);
    WN_FLOAT32 WNDistance(const WNPlane& _plane, const WNPoint3& _point2);
    WN_FLOAT32 WNDistanceSquared(const WNPoint2& _point1, const WNPoint2& _point2);
    WN_FLOAT32 WNDistanceSquared(const WNPoint3& _point1, const WNPoint3& _point2);
    WN_FLOAT32 WNDistanceSquared(const WNPlane& _plane, const WNPoint3& _point);
    WNPoint2 WNMidPoint(const WNPoint2& _point1, const WNPoint2& _point2);
    WNPoint3 WNMidPoint(const WNPoint3& _point1, const WNPoint3& _point2);

    WN_FLOAT32 WNDot(const WNVector2& _vector1, const WNVector2& _vector2);
    WN_FLOAT32 WNDot(const WNVector3& _vector1, const WNVector3& _vector2);
    WN_FLOAT32 WNDot(const WNQuaternion& _quat1, const WNQuaternion& _quat2);
    WN_FLOAT32 WNCross(const WNVector2& _vector1, const WNVector2& _vector2);
    WNVector3 WNCross(const WNVector3& _vector1, const WNVector3& _vector2);
    WN_FLOAT32 WNAngleBetween(const WNVector2& _vector1, const WNVector2& _vector2);
    WN_FLOAT32 WNAngleBetween(const WNVector3& _vector1, const WNVector3& _vector2);

    WNVector2 WNLerp(const WNVector2& _start, const WNVector2& _end, WN_FLOAT32 _amount);
    WNVector3 WNLerp(const WNVector3& _start, const WNVector3& _end, WN_FLOAT32 _amount);
    WNQuaternion WNLerp(const WNQuaternion& _quatStart, const WNQuaternion& _quatEnd, WN_FLOAT32 _amount);
    WNVector2 WNSLerp(const WNVector2& _start, const WNVector2& _end, WN_FLOAT32 _amount);
    WNVector3 WNSLerp(const WNVector3& _start, const WNVector3& _end, WN_FLOAT32 _amount);
    WNQuaternion WNSLerp(const WNQuaternion& _quatStart, const WNQuaternion& _quatEnd, WN_FLOAT32 _amount);

    WN_BOOL WNIntersect(const WNLine2& _line1, const WNLine2& _line2, WNPoint2& _intersection);
    WN_BOOL WNIntersect(const WNRay2& _line1, const WNRay2& _line2, WNPoint2& _intersection);
    WN_BOOL WNIntersect(const WNSegment2& _segment1, const WNSegment2& _segment2, WNPoint2& _intersection);
    WN_BOOL WNIntersect(const WNLine3& _line, const WNPlane& _plane, WNPoint3& _intersection);
    WN_BOOL WNIntersect(const WNRay3& _ray, const WNPlane& _plane, WNPoint3& _intersection);
    WN_BOOL WNIntersect(const WNSegment3& _segment, const WNPlane& _plane, WNPoint3& _intersection); 
    WN_BOOL WNIntersect(const WNPlane& _plane1, const WNPlane& _plane2, WNLine3& _intersection);
}

#endif // __WN_EXTENDED_MATH_H__